//Stephen Kirksharian
//Robert Harkreader
//CPSC 321
//DUE 4/27/08


//Testing Program counter
module PC(Reset, startProgramCounter, PCnext, clock, PCout,globalReset);

  output[31:0]PCout;
  reg [31:0] PCout;
  output globalReset;
  reg globalReset;

  input[31:0]PCnext, startProgramCounter;
  input clock, Reset;

  reg[2:0]Count;

  initial begin
	Count=0;
	globalReset=0;
  end

	//ONLY CHANGES ON NEGATIVE EDGE

  always@(negedge clock)   begin 
        if(~Reset)
        begin
		Count=Count+1;
		if(Count==5) PCout = startProgramCounter;
	end
	else
	begin
	       globalReset=1;
	       Count=0;
	       PCout = PCnext;
	end
  end
endmodule